package cn.domob.android.ads;

import android.content.Context;

class B extends DomobAdView
  implements DomobAdEventListener
{
  private static J p = new J(B.class.getSimpleName());
  private String q;
  private String r;
  private int s;
  private DomobSplashAdListener t;
  private y.a u;

  B(Context paramContext, String paramString)
  {
    super(paramContext, paramString, null);
    p.a("Init SplashAdView.");
    if (this.a != null)
    {
      this.a.a(false);
      this.a.b(false);
    }
    this.f.setVisibility(0);
    this.b = DomobAdView.a.d.ordinal();
  }

  private boolean p()
  {
    ae localae = new g().b(this.c);
    if (localae == null)
    {
      p.a("There is no available cache ad.");
      ((A)this.a).a(null, "sp_no_creative");
    }
    while (true)
    {
      return false;
      if (System.currentTimeMillis() / 1000L >= localae.d())
      {
        p.a("Cached ad expires.");
        ((A)this.a).a(l.a(localae.c()), "sp_expire");
      }
      this.q = localae.b();
      this.r = localae.c();
      this.s = new g().b(this.c, this.q);
      if (this.s != -1)
      {
        p.a("All resources of creative is ok.");
        return true;
      }
      p.a("Some resources of creative is not ok.");
      ((A)this.a).a(l.a(this.r), "sp_res_incomplete");
    }
  }

  void a(Context paramContext)
  {
    p.b("Load cached Ad:" + this.r);
    this.c = paramContext;
    super.setAdEventListener(this);
    this.a.c(true);
    l locall = l.a(this.r);
    if ((locall != null) && (locall.d() != null))
      locall.d().a(this.s);
    this.a.a(locall, -1);
  }

  void a(DomobSplashAdListener paramDomobSplashAdListener)
  {
    this.t = paramDomobSplashAdListener;
  }

  protected void a(String paramString)
  {
    this.a = new A(this, paramString);
  }

  protected void j()
  {
  }

  protected void k()
  {
    if (this.u == null)
      return;
    this.u.a();
  }

  boolean m()
  {
    if (p())
    {
      p.a("Both splash ad response and it's resources are OK.");
      return true;
    }
    requestRefreshAd();
    return false;
  }

  protected void n()
  {
    label6: boolean bool2;
    try
    {
      Thread.sleep(100L);
      invalidate();
      boolean bool1 = this.a.u().d().p();
      int i = this.a.u().d().q();
      int j = this.a.u().d().r();
      y.a locala1 = new y.a(this.c).a(this.i, this.j).a(bool1);
      if (i == 0)
        break label157;
      bool2 = true;
      y.a locala2 = locala1.a(bool2, i);
      boolean bool3 = false;
      if (j != 0)
        bool3 = true;
      this.u = locala2.b(bool3, j).b(true).a(new y.b()
      {
        public void a()
        {
          if (B.a(B.this) != null)
            B.a(B.this).onSplashPresent();
          B.this.a.a("s", "s", 0L);
        }

        public void b()
        {
          B.this.a.a("m", "s", B.this.a.e());
        }

        public void c()
        {
          B.this.a.a("f", "s", B.this.a.e());
          if (B.a(B.this) != null)
            B.a(B.this).onSplashDismiss();
          B.o().a("Request another Ad when current cached Ad is shown.");
          B.o().a("Delete old cached ad response.");
          new g().a(B.this.c, B.b(B.this));
          new g().c(B.this.c);
          B.this.setOnAdListener(null);
          B.this.setAdEventListener(null);
          B.this.requestRefreshAd();
        }
      });
      this.u.a(this);
      label157: return;
    }
    catch (Exception localException)
    {
      p.a(localException);
      break label6:
      bool2 = false;
    }
  }

  protected void onAttachedToWindow()
  {
    invalidate();
  }

  public void onDomobAdClicked(DomobAdView paramDomobAdView)
  {
  }

  public void onDomobAdFailed(DomobAdView paramDomobAdView, DomobAdManager.ErrorCode paramErrorCode)
  {
    p.e("Failed to load ad or get ad responce.");
    if (this.t == null)
      return;
    this.t.onSplashLoadFailed();
  }

  public void onDomobAdOverlayDismissed(DomobAdView paramDomobAdView)
  {
  }

  public void onDomobAdOverlayPresented(DomobAdView paramDomobAdView)
  {
  }

  public void onDomobAdReturned(DomobAdView paramDomobAdView)
  {
    p.a("Get new splash ad responce.");
  }

  public void onDomobLeaveApplication(DomobAdView paramDomobAdView)
  {
  }
}

/* Location:           C:\Users\god\Desktop\liunianjishiben_V1.1_mumayi_3745b_dex2jar.jar
 * Qualified Name:     cn.domob.android.ads.B
 * JD-Core Version:    0.5.4
 */